From 2169f50919be21b48fe1916af7ab663ac8d0b1a7 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 2 Mar 2004 23:29:21 +0000 Subject: [PATCH] Add an animation mode, to test how the combobox behaves if the model Wed Mar 3 00:28:59 2004 Matthias Clasen * tests/testcombochange.c: Add an animation mode, to test how the combobox behaves if the model changes while it is popped up. --- ChangeLog | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-4 | 6 ++++++ ChangeLog.pre-2-6 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ tests/testcombochange.c | 39 +++++++++++++++++++++++++++++++++++++-- 6 files changed, 67 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2b2577a924..bfc8abfa0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Mar 3 00:28:59 2004 Matthias Clasen + + * tests/testcombochange.c: Add an animation mode, to test + how the combobox behaves if the model changes while it is popped + up. + Tue Mar 2 17:06:05 2004 Owen Taylor * === Released 2.3.5 === diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 2b2577a924..bfc8abfa0c 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +Wed Mar 3 00:28:59 2004 Matthias Clasen + + * tests/testcombochange.c: Add an animation mode, to test + how the combobox behaves if the model changes while it is popped + up. + Tue Mar 2 17:06:05 2004 Owen Taylor * === Released 2.3.5 === diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 2b2577a924..bfc8abfa0c 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +Wed Mar 3 00:28:59 2004 Matthias Clasen + + * tests/testcombochange.c: Add an animation mode, to test + how the combobox behaves if the model changes while it is popped + up. + Tue Mar 2 17:06:05 2004 Owen Taylor * === Released 2.3.5 === diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 2b2577a924..bfc8abfa0c 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +Wed Mar 3 00:28:59 2004 Matthias Clasen + + * tests/testcombochange.c: Add an animation mode, to test + how the combobox behaves if the model changes while it is popped + up. + Tue Mar 2 17:06:05 2004 Owen Taylor * === Released 2.3.5 === diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 2b2577a924..bfc8abfa0c 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +Wed Mar 3 00:28:59 2004 Matthias Clasen + + * tests/testcombochange.c: Add an animation mode, to test + how the combobox behaves if the model changes while it is popped + up. + Tue Mar 2 17:06:05 2004 Owen Taylor * === Released 2.3.5 === diff --git a/tests/testcombochange.c b/tests/testcombochange.c index 97224b3729..965460f551 100644 --- a/tests/testcombochange.c +++ b/tests/testcombochange.c @@ -155,11 +155,11 @@ on_reorder (void) for (i = 0; i < contents->len; i++) shuffle_array[i] = i; - for (i = 0; i < contents->len - 1; i++) + for (i = 0; i + 1 < contents->len; i++) { gint pos = g_random_int_range (i, contents->len); gint tmp; - + tmp = shuffle_array[i]; shuffle_array[i] = shuffle_array[pos]; shuffle_array[pos] = tmp; @@ -179,6 +179,37 @@ on_reorder (void) g_free (shuffle_array); } +static int n_animations = 0; +static int timer = 0; + +static gint +animation_timer (gpointer data) +{ + switch (g_random_int_range (0, 3)) + { + case 0: + on_insert (); + break; + case 1: + on_delete (); + break; + case 2: + on_reorder (); + break; + } + + n_animations--; + return n_animations > 0; +} + +static void +on_animate (void) +{ + n_animations += 20; + + timer = g_timeout_add (1000, (GSourceFunc) animation_timer, NULL); +} + int main (int argc, char **argv) { @@ -262,6 +293,10 @@ main (int argc, char **argv) gtk_box_pack_start (GTK_BOX (button_vbox), button, FALSE, FALSE, 0); g_signal_connect (button, "clicked", G_CALLBACK (on_reorder), NULL); + button = align_button_new ("Animate"); + gtk_box_pack_start (GTK_BOX (button_vbox), button, FALSE, FALSE, 0); + g_signal_connect (button, "clicked", G_CALLBACK (on_animate), NULL); + gtk_widget_show_all (dialog); gtk_dialog_run (GTK_DIALOG (dialog)); -- 2.30.2